package com.synjones.ui.lunch;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.synjones.idcardusb_reader.R;
import com.synjones.ui.FirstScreenRouter;
import com.synjones.ui.MainActivity;
import com.synjones.ui.SecondScreenRouter;


public class LunchFragment extends Fragment {

    private ImageView selfSign;
    private ImageView otherSign;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_lunch, container, false);
        selfSign = (ImageView) view.findViewById(R.id.welSelfSign);
        otherSign = (ImageView) view.findViewById(R.id.welOtherSign);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        MainActivity mainActivity = (MainActivity) getActivity();
        final FirstScreenRouter router1 = mainActivity.getRouter1();
        final SecondScreenRouter router2 = mainActivity.getRouter2();
        selfSign.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                router1.gotoRecognize(true);
                router2.gotoRecognize(true);
            }
        });
        otherSign.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               router1.gotoRecognize(false);
               router2.gotoRecognize(false);
            }
        });
    }
}
